home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ARASAN_S.ZIP / BOOKREAD.H < prev    next >
C/C++ Source or Header  |  1993-11-19  |  995b  |  51 lines

  1. // Copyright 1992 by Jon Dart.  All Rights Reserved.
  2.  
  3. #ifndef _BOOK_READER_H
  4. #define _BOOK_READER_H
  5.  
  6. #include "bookentr.h"
  7. #include "board.h"
  8. #include <windows.h>
  9.  
  10. class Book_Reader
  11. {
  12.     // provides read-only access to the opening book.
  13.  
  14.     public:
  15.  
  16.     Book_Reader(const char * const filename);
  17.     // opens book file
  18.         
  19.     ~Book_Reader();
  20.     // closes book file
  21.         
  22.     const Boolean Is_Open() const
  23.     {
  24.        return is_open;
  25.     }
  26.         
  27.     const unsigned Size() const
  28.     // Return number of half-moves in the book.
  29.     {
  30.        return my_size;
  31.     }
  32.         
  33.     const unsigned Head( const Board &b);
  34.     // returns an index to the head of the hash chain for the
  35.     // board position.
  36.  
  37.     void Fetch( const uint16 n, Book_Entry &book_entry );
  38.     // Fetches the nth book entry from the file.
  39.     // NOTE: n must satisfy: 0 <= n < Size().  Reads
  40.     // need not be sequential.
  41.         
  42.        protected:
  43.            
  44.        HWND hBook;
  45.        Boolean is_open;
  46.        unsigned my_size, my_hash_size;
  47.        
  48. };
  49.  
  50. #endif
  51.